import 'package:logger/logger.dart';

class MyLog {
  // static final MyLog _instance = MyLog._();

  MyLog._();

  //factory MyLog() => _instance;
  static const bool isDebug = true;
  static final logger = Logger(
    printer: PrettyPrinter(
      // number of method calls to be displayed
      methodCount: 2,
      // number of method calls if stacktrace is provided
      errorMethodCount: 4,
      // width of the output
      lineLength: 60,
      // Colorful log messages
      colors: true,
      // Print an emoji for each log message
      printEmojis: true,
      // Should each log print contain a timestamp
      printTime: true,
    ),
  );

  // static const MethodChannel _channel = MethodChannel("log.channel");
  static void d(String tag, String msg) async {
    if (isDebug) {
      // logger.d(msg);
      logger.d("tag: $tag, msg: $msg");
    }
  }

  static void i(String tag, String msg) async {
    if (isDebug) {
      // logger.i(msg);
      logger.i("tag: $tag, msg: $msg");
    }
  }

  static void w(String tag, String msg) async {
    if (isDebug) {
      // logger.w(msg);
      logger.w("tag: $tag, msg: $msg");
    }
  }

  static void e(String tag, String msg) async {
    if (isDebug) {
      // logger.e(msg);
      logger.e("tag: $tag, msg: $msg");
    }
  }
}
